<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
	<meta name="author" content="m.ehaier.com">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" name="viewport"  />
	<meta name="format-detection" content="telephone=no" />
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
	<meta content="telephone=no" name="format-detection" />
	<meta content="false" id="twcClient" name="twcClient" />
	<link type="text/css" rel="stylesheet" href="user/css/v2/style.css">
	<title>经典西游用户中心</title>
<link type="text/css" rel="stylesheet" href="user/css/v2/member.css">
<script src="admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script src="admin/lib/layer/2.4/layer.js"></script>
<script src="admin/lib/geturl.js"></script>
</head>
<body id="page">
<header class="header"> 
	<span class="fh left"></span>  	注册
  	<span class="hd_right right">
	
</span>
</header>
<span id="login_errorMsg" style="padding:10px;"></span>
<div class="Login">
  <div class="Login_top">
    <ul>
      <li><A href="index.html">登录</A></li>
      <li class="cur"><A href="reg.html">注册</A></li>
    </ul>
  </div>
  <div> 
    <div class="Login_bottom" >
      <form id="form1" onsubmit="return false" action="#" method="post">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="60" align="left" valign="middle"><input type="text" id="user" name="user" placeholder="用户名" class="login_wbk" onkeyup="value=value.replace(/[\u4e00-\u9fa5]/ig,'')">
              <span id="mobileNumMsg"></span></td>
          </tr>
          <tr>
            <td height="60" align="left" valign="middle"><input type="password" id="pass" name="pass" placeholder="设置密码"  class="login_wbk"></td>
          </tr>
          <tr>
            <td height="60" align="left" valign="middle"><input type="password" id="pass1" name="pass1" placeholder="确认密码"  class="login_wbk"></td>
          </tr>
		  <tr>
            <td height="60" align="left" valign="middle"><input type="type" id="code" name="code" placeholder="邀请码" maxlength="4" class="login_wbk"></td>
          </tr>
            <td height="60" align="center" valign="middle">
			<input class="dl_login" onclick="login()" name="button" type="button" id="button" value="注册" />
			</td>
          
          <tr>
            <td height="30" >&nbsp;</td>
          </tr>
        </table>
      </form>
    </div>
   </div>
</div>

<footer class="footer">
	<div id="footer" class="ft_top">
				<a href="index.html">登录</a>|<a href="reg.html">注册</a>
			</div>
  	<p><a href="javascript:scroll(0,0)">返回顶部</a>|<a href="../../index.html">返回首页</a>|<a href="#">意见反馈</a> </p>
  	<p>Copyright©2020</p>
</footer>
<script type="text/javascript">

function login() {
        var user=document.getElementById("user").value;
        var pass=document.getElementById("pass").value;
        var pass1=document.getElementById("pass1").value;
        var code=document.getElementById("code").value;
        if(user==""){
        layer.msg('用户名不能为空');
        return false;
        }
        if(pass==""){
        layer.msg('密码不能为空');
        return false;
        }
        if(code==""){
        layer.msg('邀请码不能为空');
        return false;
        }
        if(pass!=pass1){
        layer.msg('两次密码不一致，请重新输入');
        return false;
        }
            $.ajax({
                type: "POST",
                url: "user/reg.php" ,
                data: $('#form1').serialize(),
                success: function (result) {
                    if (result == "ok") {
                        layer.alert('注册成功', {
            icon: 1,
            skin: 'layer-ext-moon' 
        });
           
                    }
                    else if (result == "error1")
                    {
                        layer.alert('账号已存在', {
            icon: 2,
            skin: 'layer-ext-moon' 
        });
                    }
                    else if (result == "error2")
                    {
                     layer.alert('邀请码不存在', {
            icon: 2,
            skin: 'layer-ext-moon' 
        });   
                    }else if (result == "error3")
                    {
                     layer.alert('注册次数过多', {
            icon: 2,
            skin: 'layer-ext-moon' 
        });   
                    }
                    else
                    {
                       layer.alert(result, {
            icon: 2,
            skin: 'layer-ext-moon' 
        });
                    }
                    ;
                },
                error : function() {
                    alert("error");
                }
            });
        }
         
</script>
</body>
</html>
